package org.crud4j.wicket.markup.html.browse;

import java.io.Serializable;
import java.util.HashMap;

import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

/**
 * This component is responsible of displaying the filters
 */
class BrowseFilterPanel extends Panel {

	private static final long serialVersionUID = 1L;

	private class BrowseFilterForm extends Form {

		private static final long serialVersionUID = 1L;

		TextField filter;

		public BrowseFilterForm(String id, IModel model) {
			super(id, model);
			BrowseModel browseModel = (BrowseModel) model.getObject();
			browseModel.setFilters(new HashMap<String, String>());
			IModel filterModel = new Model((Serializable) browseModel
					.getFilters());
			filter = new TextField("filter", filterModel);
			add(filter);
		}

		protected void onSubmit() {

		}

	}

	public BrowseFilterPanel(String id, IModel model) {
		super(id, model);
		add(new BrowseFilterForm("filterForm", model));
	}

}
